import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

const app = {
  state: {
    userInfo: sessionStorage.getItem("userInfo")
      ? JSON.parse(sessionStorage.getItem("userInfo"))
      : null,
  },
  
  mutations: {
    setUserInfo(state, data) {
      state.userInfo = { ...data };
    },
  },
  actions: {},
};

const store = new Vuex.Store({
  modules: {
    app,
  },
  getters:{
    userInfo: (state) => state.app.userInfo,
  },
});
export default store
